package Model;

import java.io.Serializable;
import java.util.ArrayList;

import Messaging.Notification;
import Messaging.NotificationManager;

/*
 * @author Roch San Buenaventura
 */

public class CardTypeMove extends Card implements Serializable 
{
	private int Space_;
	final static long serialVersionUID = 201;
	
	public CardTypeMove() 
	{
		Message_ = "NONE";
		Space_ = 0;
	}

	public CardTypeMove(String message, int space) 
	{
		Message_ = message;
		
		if (space > 39) 
		{
			System.out.print("Invalid space number passed to CardTypeMove()");
			Space_ = space % 40;
		}
		
		Space_ = space;
	}
	
	public void setSpace(int space) 
	{
		if (space > 39) 
		{
			System.out.print("Invalid space number passed to CardTypeMove()");
			Space_ = space % 40;
		}
		Space_ = space;
	}

	public int getSpace() {
		return Space_;
	}
	
	public void landOn(Player p, ArrayList<Player> players) 
	{
		p.setPosition(getSpace());
		NotificationManager.getInstance().notifyObservers(Notification.CARD_MOVE, new Integer(getSpace()));
		if (getSpace() == 10)
			p.goToJail();
	}
}
